#include "../common.h"
using namespace std;
extern BuiltinCmd blt[MAX_BUILTIN_FUNC_NUM];
extern char buf[80];
int git_init() {
    BuiltinCmd x;
    strcpy(x.name, "init");
    strcpy(x.desc, "Initialize the warehouse");
    x.hasAction = true;
    x.optNum = 2;
    strcpy(x.Help,"git init");
	strcpy(x.action, "Initialized empty Git repository in");
	addBuiltinCmd(&x);
	
//	strcpy(x.action[1],"Reinitialized existing Git repository in");
    return 0;
}

int git_init_cmdpline(int pos,int retc,char **retv){
	printf("%s %s\n",blt[pos].action,retv[3]);
	return 0;
}

int git_init_run(int retc,char **retv){
	FILE *fp=fopen("D:\\self-git\\git\\directory\\directory.txt","w");
	char dir[MAX_BUILTIN_DESC_LENGTH];
	chdir(retv[3]);
	getcwd(buf, sizeof(buf));
    printf("current working directory : %s\n", buf);
    fputc('\n',fp);
	fwrite(buf,1,strlen(buf),fp);
	fclose(fp);
	return 0;
}
